﻿using System.Linq.Expressions;

namespace ConsoleApp9
{
    //对象和集合初始值设定项

    //对象初始化器
    class Person
    {
        public string name { get; set; }
        public int age { get; set; }
    }

    

    internal class Program
    {
        static void Main(string[] args)
        {
            //对象初始化器
            Person person = new Person()
            {
                name = "shangshoulai",
                age = 23
            };
            Console.WriteLine($"name:{person.name}\nage:{person.age}");
            Console.WriteLine("***************");
            //集合初始化器
            List<string> names = new List<string>() { "Tom", "Jack", "Lucy" };
            foreach (var name in names)
            {
                Console.WriteLine(name);
            }
        }



    }
}